//
//  Requirement.m
//  Fangmm
//
//  Created by 阮琦 on 16/3/9.
//  Copyright © 2016年 com.fangmm. All rights reserved.
//

#import "Requirement.h"

@implementation Requirement

-(instancetype)init
{
    self = [super init];
    if (self) {
    }
    return self;
}

-(instancetype)initWithDic:(NSDictionary*)dic
{
    self = [super init];
    if (self)
    {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    NSLog(@"key = %@",key);
}

-(void)encodeWithCoder:(NSCoder *)encoder{
    [encoder encodeObject:self.createTime forKey:@"createTime"];
    [encoder encodeObject:self.price forKey:@"price"];
    [encoder encodeObject:self.district forKey:@"district"];
    [encoder encodeObject:self.region forKey:@"region"];
    [encoder encodeObject:self.userGender forKey:@"userGender"];
    [encoder encodeObject:self.userId forKey:@"userId"];
    [encoder encodeObject:self.userMobile forKey:@"userMobile"];
    [encoder encodeObject:self.userName forKey:@"userName"];
    [encoder encodeInt:self.day forKey:@"day"];
    [encoder encodeInt:self.regionCode forKey:@"regionCode"];
}

#pragma mark 从文件中读取
-(id)initWithCoder:(NSCoder *)decoder{
    self.createTime = [decoder decodeObjectForKey:@"createTime"];
    self.price = [decoder decodeObjectForKey:@"price"];
    self.district = [decoder decodeObjectForKey:@"district"];
    self.region = [decoder decodeObjectForKey:@"region"];
    self.userGender = [decoder decodeObjectForKey:@"userGender"];
    self.userId = [decoder decodeObjectForKey:@"userId"];
    self.userMobile = [decoder decodeObjectForKey:@"userMobile"];
    self.userName = [decoder decodeObjectForKey:@"userName"];
    self.day = [decoder decodeIntForKey:@"day"];
    self.regionCode = [decoder decodeIntForKey:@"regionCode"];
    return self;
}


@end
